<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" type="text/css" href="../css/common.css"/>
<link rel="stylesheet" type="text/css" href="../fonts/iconfont.css"/>
<style>
#dongtaibox{
	padding: 1rem;
	background: #fff;
	box-shadow:0 0 1px #ccc;
	-webkit-box-shadow:1px 0 1px #ccc;
	position: relative;
}
#contetns{
	display: block;
	width:100%;
	border: 0;
	height: 20rem;
	overflow: hidden;
	font-size: 1.8rem;
	line-height: 3rem;
}
#contetns:focus{
	outline: none;
}
#photos{
	flex-wrap:wrap;
	-webkit-flex-wrap: wrap;
}
.photoitem{
	width: 23.5%;
	height: 8rem;
	background: #eee;
	margin-bottom: 4px;
	overflow: hidden;
	margin-right: 4px;
}
#addimg{
	text-align: center;
	line-height: 8rem;
	font-size: 6rem;
	color: #ccc;
}
.biaoqin{
	width: 100%;
	height: auto;
	position: absolute;
	bottom: 0;
	left: 0;
	font-size: 2rem;
	padding-left: 1rem;
	padding: 1rem 1rem 0.5rem 1rem;
	color:orange;
}
.biaoqin-inner{
	padding: 0 1rem 0 1rem;
}
.icon-yuyin{
	padding-left:3rem;
}
</style>
</head>
<body>
<div id="jcontent" class="jcontent">
	<div id="dongtaibox">
		<textarea id="contetns" placeholder="您的评论也可以很精彩..."></textarea>
		<div class="biaoqin line-t">
			<a class="biaoqin-inner"><i class="iconfont icon-biaoqing-copy"></i></a>
			<a id="yuyin" class="biaoqin-inner"><i class="iconfont icon-yuyin"></i></a>
		</div>
	</div>
	<a id="blockbtn" class="blockbtn">确认发布</a>
</div>
<script src="../js/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	mui('#jcontent').on('tap','#blockbtn', function() {
		var _content=document.getElementById("contetns").value;
		if(webapp.util.isNull(_content)){
			mui.toast("请填写您需要发表的内容");
			return false;
		}
		webapp.ajax({
			url:"/carLife/admin/interface/comment/add/save",
			data:{
				targetId:webapp.GetQueryString("id"),
				content:_content,
				type:1
			},
			success:function(json){
				if(json.code==200){
					var _webview=plus.webview.getWebviewById("common-sub");
					mui.fire(_webview,"refreshList");
				}else{
					mui.toast("请求失败");
				}
			}
		});	
	});
	
	
	mui('#jcontent').on('tap','#yuyin', function() {
		startRecognize();
	});
	
	function startRecognize() {
		var text=document.getElementById("contetns");
	    if(plus.os.name=='Android'&&navigator.userAgent.indexOf('StreamApp')>0){
	        plus.nativeUI.toast('当前环境暂不支持语音识别插件');
	        return;
	    }
	    var options = {};
	    options.engine = 'iFly';
	    plus.speech.startRecognize( options, function ( s ) {
	      text.innerHTML=text.value+s;
	    }, function ( e ) {
	    } );
	}
</script>
</body>
</html>
